using System.Data;
using VanTaiProperty;

namespace VanTaiData
{
    public class ClsTmCurrencyController
    {
        private clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdTmCurrency(string keywords)
        {
            return cls.Search("sp_TMCurrency", "@KeyWords", keywords);
        }
        public DataTable BindGirdTmCurrencyDetail(int id)
        {
            return cls.LayDuLieuParameter("sp_TMCurrency_Detail", "@Currency_ID", id);
        }
        #endregion

        #region Insert
        public bool InsertTmCurrency(ClsTmCurrencyProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Currency_Alias", data.Currency_Alias);
            cls.AddParameter("@Currency_Name", data.Currency_Name);
            cls.AddParameter("@Currency_Rate", data.Currency_Rate);
            cls.AddParameter("@Currency_Note", data.Currency_Note);
            cls.AddParameter("@Currency_MaCha", data.Currency_MaCha);
            cls.AddParameter("@Currency_NameE", data.Currency_NameE);
            cls.AddParameter("@Currency_NameC", data.Currency_NameC);
            cls.ExecuteNonQuery("sp_TMCurrency_Insert");
            return true;
        }
        #endregion

        #region Update
        public bool UpdateTmCurrency(ClsTmCurrencyProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Currency_ID", data.Currency_ID);
            cls.AddParameter("@Currency_Alias", data.Currency_Alias);
            cls.AddParameter("@Currency_Name", data.Currency_Name);
            cls.AddParameter("@Currency_Rate", data.Currency_Rate);
            cls.AddParameter("@Currency_Note", data.Currency_Note);
            cls.AddParameter("@Currency_MaCha", data.Currency_MaCha);
            cls.AddParameter("@Currency_NameE", data.Currency_NameE);
            cls.AddParameter("@Currency_NameC", data.Currency_NameC);
            cls.ExecuteNonQuery("sp_TMCurrency_Update");
            return true;
        }
        #endregion

        #region Delete
        public bool DeleteTmCurrency(int id)
        {
            cls.Delete("sp_TMCurrency_Delete", "@Currency_ID", id);
            return true;
        }
        #endregion
    }
}